package com.lwj.webservice;

import com.lwj.webservice.wsentity.GetUserDetalis;
import com.lwj.webservice.wsentity.GetUserDetalisResponse;

public class TestWebService {
    /**
     * 使用java/bin 下的wsimport 目录生成接口实体类GetUserDetalis，GetUserDetalisResponse
     * 如wsimport -encoding utf-8 -s f:\tmp http://127.0.0.1:8080/userService?wsdl
     * -encoding utf-8：使用的字符集
     * -s：生成.java文件
     * f:\tmp ： 指定目录
     * http://127.0.0.1:8080/userService?wsdl： webservice服务路径
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
        SoapEntity request=new SoapEntity(null, GetUserDetalis.class);
        SoapEntity response=new SoapEntity(null, GetUserDetalisResponse.class);
        GetUserDetalis getUserDetalis=new GetUserDetalis();
        getUserDetalis.setUserId("1");
        request.setBody(getUserDetalis);
        //SoapEntity<PH, PB> response
        SoapClient.execute("http://127.0.0.1:8080/userService",request,response);
        SoapFault fault = response.getFault();
        Object body = response.getBody();
        System.out.println(body);
        System.out.println(fault);
    }
}
